-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add ndarray/splice
#9807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: add ndarray/splice
#9807
Conversation
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
|
||
| # splice | ||
|
|
||
| > Return an [`ndarray`][@stdlib/ndarray/ctor] where elements of an input [`ndarray`][@stdlib/ndarray/ctor] are replaced or removed along a specific dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| > Return an [`ndarray`][@stdlib/ndarray/ctor] where elements of an input [`ndarray`][@stdlib/ndarray/ctor] are replaced or removed along a specific dimension | |
| > Return an [`ndarray`][@stdlib/ndarray/ctor] where elements of an input [`ndarray`][@stdlib/ndarray/ctor] are replaced or removed along a specific dimension. |
|
|
||
| The function accepts the following `options`: | ||
|
|
||
| - **dim**: dimension along which to perform the operation. Must be a negative integer. The index is resolved relative to the last dimension, with the last dimension corresponding to the value `-1`. Default: `-1`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dim should be allowed to be any integer, not just negative integers, as dim unambiguously applies to x.
| * Returns an ndarray where the elements of an input ndarray are replaced or removed along a specific dimension. | ||
| * | ||
| * @param {ndarray} x - input array | ||
| * @param {(Slice|integer)} s - slice object or an integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @param {(Slice|integer)} s - slice object or an integer | |
| * @param {(Slice|integer|null|void)} s - slice object or an integer |
| throw new TypeError( format( 'invalid argument. Values argument must be an ndarray. Value: `%s`.', v ) ); | ||
| } | ||
| hasValues = true; | ||
| } else if ( nargs === 3 ) { // Case: splice( x, s, ???) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } else if ( nargs === 3 ) { // Case: splice( x, s, ???) | |
| } else if ( nargs === 3 ) { // Case: splice( x, s, ??? ) |
| var splice = require( '@stdlib/ndarray/splice' ); | ||
| ``` | ||
|
|
||
| #### splice( x, slice\[, values\[, options]] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #### splice( x, slice\[, values\[, options]] ) | |
| #### splice( x, slices\[, values\[, options]] ) |
where slices is an array of slices and values is an array of ndarrays, having a length equal to slices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
splice( x, [ s1 ], [ values1 ], opts );
splice( x, s1, values1, opts ); // ^^^ shorthand for this common use case
splice( x, [ s1, s2 ], [ values1, values2 ], opts ); // if provided more than one slice, always need to provide an array of ndarrays for `values`There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When supporting multiple slice objects,
- need to validate that the slice regions do not overlap.
- need to sort the slice regions (and thus values) based on the slice
start.
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves stdlib-js/metr-issue-tracker#135.
Description
This pull request:
ndarray/spliceRelated Issues
This pull request has the following related issues:
ndarray/splicemetr-issue-tracker#135Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers